<?php
namespace Common\Model;
use Think\Model;

class NavModel extends  Model {
    private $_db = '';
    public function __construct() {
        $this->_db = M('nav');
    }


    public function insert($data = array()) {
        if(!$data || !is_array($data)) {
            return 0;
        }
        return $this->_db->add($data);
    }
      public function getNavs($data,$page,$pageSize) {
        $data['status'] = array('neq',-1);
        $offset = ($page - 1) * $pageSize;
        $list = $this->_db->where($data)->limit($offset,$pageSize)->order('nav_id desc')->select();
        return $list;
    }

    public function getNavsCount($data= array()) {
        $data['status'] = array('neq',-1);
        return $this->_db->where($data)->count();
    }


}    